﻿<div class="content-page-view" data-ng-controller="PagesController">
    <div class="main-header clearfix">
        <h2 class="page-title pull-left"> {{lbl.pages}}</h2>
        <a href="{{SiteVars.RelativeWebRoot}}admin/app/editor/editpage.cshtml" class="btn btn-hasicon btn-sm btn-success pull-left"><i class="fa fa-plus"></i>{{lbl.theNew}}</a>
        <div class="btn-group befdv pull-left">
            <a ng-click="processChecked('delete', itemsChecked())" ng-disabled="itemsChecked() === false" class="btn btn-sm btn-danger" angular-tooltip tooltip="lbl.doDelete"><i class="fa fa-trash"></i></a>
            <a ng-click="processChecked('unpublish', itemsChecked())" ng-disabled="itemsChecked() === false" class="btn btn-sm btn-warning" angular-tooltip tooltip="lbl.unpublish"><i class="fa fa-archive"></i></a>
            <a ng-click="processChecked('publish', itemsChecked())" ng-disabled="itemsChecked() === false" class="btn btn-sm btn-success" angular-tooltip tooltip="lbl.publish"><i class="fa fa-check"></i></a>
        </div>
        <button class="right-side-toggle pull-right"><span></span><span></span><span></span></button>
        <div class="right-side pull-right">
            <div class="search pull-right">
                <i class="fa fa-search"></i>
                <input type="text" ng-model="query" ng-change="search()" placeholder="{{lbl.search}}..." />
            </div>
            <div class="dropdown pull-right">
                <button class="btn btn-default btn-sm dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">{{lbl.all}} <i class="fa fa-angle-down"></i></button>
                <ul class="dropdown-menu dropdown-menu-filter">
                    <li><a id="fltr-all" data-value="{{lbl.all}}" ng-click="gridFilter('IsPublished','all','all')">{{lbl.all}}</a>            </li>
                    <li><a id="fltr-pub" data-value="{{lbl.published}}" ng-click="gridFilter('IsPublished',true,'pub')">{{lbl.published}}</a> </li>
                    <li><a id="fltr-dft" data-value="{{lbl.drafts}}" ng-click="gridFilter('IsPublished',false,'dft')">{{lbl.drafts}}</a>      </li>
                </ul>
            </div>
        </div>
    </div>
    <div class="content-inner">
        <table class="table table-item-page">
            <thead>
                <tr>
                    <th class="item-checkbox"><input type="checkbox" id="chkAll" ng-click="checkAll($event)" /></th>
                    <th class="item-title"><a data-ng-click="sort_by('Title',$event)">{{lbl.title}}</a></th>
                    <th class="item-parent">{{lbl.parent}}</th>
                    <th class="item-sort"><a data-ng-click="sort_by('SortOrder', $event)">{{lbl.sortOrder}}</a></th>
                    <th class="item-date"><a data-ng-click="sort_by('DateCreated',$event)">{{lbl.date}}</a></th>
                    <th class="item-show">{{lbl.showInList}}</th>
                    <th class="item-status">{{lbl.published}}</th>
                </tr>
            </thead>
            <tbody>
                <tr data-ng-repeat="item in pagedItems[currentPage] | orderBy:sortingOrder:reverse">
                    <td class="item-checkbox"><input type="checkbox" id="{{item.Slug}}" data-ng-model="item.IsChecked" ng-disabled="item.HasChildren === true" /></td>
                    <td class="item-title">
                        <a title="click to edit" href="{{SiteVars.RelativeWebRoot}}admin/app/editor/editpage.cshtml?id={{item.Id}}">{{item.Title}}</a>
                        <a title="click to view" target="_blank" href="{{SiteVars.RelativeWebRoot}}page/{{item.Slug}}" class="external-link"><i class="fa fa-external-link"></i></a>
                    </td>
                    <td class="item-parent">{{item.Parent.OptionName}}</td>
                    <td class="item-sort">{{item.SortOrder}}</td>
                    <td class="item-date" title="{{item.DateCreated}}">{{item.DateCreated.substring(0,10)}}</td>
                    <td class="item-show"><input type="checkbox" data-ng-model="item.ShowInList" data-ng-disabled="true"></td>
                    <td class="item-status"><input type="checkbox" data-ng-model="item.IsPublished" data-ng-disabled="true"></td>
                </tr>
            </tbody>
        </table>
        <div class="table-item-empty" id="tr-spinner"><div id="div-spinner"><i class="fa fa-spinner fa-spin"></i></div></div>
        <ul class="pagination" ng-if="items.length > itemsPerPage">
            <li data-ng-class="{disabled: currentPage == 0}"><a data-ng-click="prevPage()" title="{{lbl.prev}}"><i class="fa fa-angle-left"></i></a></li>
            <li data-ng-repeat="n in range(pagedItems.length)" data-ng-class="{active: n == currentPage}" data-ng-click="setPage()"><a data-ng-bind="n + 1">1</a></li>
            <li data-ng-class="{disabled: currentPage == pagedItems.length - 1}"><a data-ng-click="nextPage()" title="{{lbl.next}}"><i class="fa fa-angle-right"></i></a></li>
        </ul>
    </div>
</div>

